

<template>
    <div class="search-wrap">
        <aside class='search-btn'>
            <ButtonGroup>
                <Button size='large'  v-for="(item,index) in btnsearch" :key="index" :type="formData.EQ_accountStatus===item.value?'primary':'ghost'" @click="handleBtn('EQ_accountStatus',item.value)">{{item.label}}</Button>
            </ButtonGroup>
        </aside>
        <article class="search-main clearfix">
            <div class="pull-right">
                <Form :label-width="70" inline>
                   <FormItem label='组织'>
                        <Select  v-model="formData.EQ_organizationId" filterable clearable>
                            <Option v-for="item in systemlist" :value="item.id" :key="item.id">{{item.name}}</Option>
                        </Select>
                    </FormItem>
					<FormItem :label-width="1">
                        <Button type="primary" @click="update" icon="ios-search-strong">搜索</Button>
                        <Button @click="reset" icon='refresh'>重置</Button>
                    </FormItem>
                </Form>
            </div>
        </article>
    </div>
</template>

<script>
import { mapState } from 'vuex';
export default {
    data() {
        return {
            btnsearch: [{
                value: 0,
                label: '正常'
            }, {
                value: 1,
                label: '欠费'
            }, {
                value: null,
                label: '全部'
            }],
            formData: {
                EQ_organizationId: '',
                EQ_accountStatus: null,
            },
        }
    },
    mounted() {
        this.update();
    },
    computed: {
        ...mapState(['systemlist'])
    },
    methods: {
        handleModal(type, id) {
            this.$parent.handleOperate(id, type);
        },
        handleBtn(key, val) {
            this.$set(this.formData, key, val);
            this.update();
        },
        update() {
            this.$emit('on-update', { search: this.formData });
        },
        reset() {
            this.formData = {
                EQ_organizationId: '',
                EQ_accountStatus: null,
            };
            this.$emit('on-update', { search: this.formData });
        },
    },
};

</script>

